﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CnGine.Comm;

public partial class admin_password : LoginBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string password = txtPassword.Text.Trim();
        string newpassword = txtPassword1.Text.Trim();
        if (password.Equals(base.User.PassWord))
        {
            Model.User u = new Model.User();
            u.PassWord = newpassword;

            if (new BLL.User().Update(u, "ID=" + base.User.ID) > 0)
            {
                Model.User u1 = base.User;
                u1.PassWord = newpassword;
                base.User = u1;
                MessageBox.Alert("密码更新成功！", this.Page);
            }
            else
            {
                MessageBox.Alert("密码更新失败，请重试！", this.Page);
            }
        }
        else
        {
            MessageBox.Alert("密码错误！", this.Page);
        }
    }
}